I have get a lots of build errors from Golang compiler after update my local Golang program for version Golang 1.14.

Errors like:

  • import cycle not allowed
  • package worker is not in GOROOT
  • can't find ...

And I have get a help from Discord. You should declare the top level project as a module, then import `my/module/name/moduleName`.

You could try to solve it if your problem(s) also from Golang module(Golang version 1.14).

I provide steps for an example below.

  1. Create a folder name "app" for your application.
  2. Create a Golang file name "main.go" in "app".
  3. Create a folder name "myModule" in "app".
  4. Create a Golang file name "myModule.go" in "myModule".
  5. run "go mod app" in "app".(in terminal)

After these, you could import myModule in main.go with import "app/myModule"